// 导入路由
import VueRouter from 'vue-router'

// 注册路由
import Vue from 'vue'
Vue.use(VueRouter)

// 创建路由对象
const router = new VueRouter({
  routes: [{
    path: '/',
    redirect: '/ui_router'
  }, {
    path: '/ui_router',
    component: () => import('@/views/UiView')
  }, {
    path: '/contacts',
    component: () => import('@/views/ContactsView'),
    // 二级路由
    children: [{
      path: 'all_contacts',
      component: () => import('@/views/contacts/AllContacts')
    }, {
      path: 'alice',
      component: () => import('@/views/contacts/AliceView')
    }, {
      path: 'bob',
      component: () => import('@/views/contacts/BobView'),
      // 三级路由
      children: [{
        path: 'blog',
        component: () => import('@/views/contacts/bob/BlogView')
      }, {
        path: 'fax',
        component: () => import('@/views/contacts/bob/FaxView')
      }]
    }]
  }, {
    path: '/about',
    component: () => import('@/views/AboutView')
  }]
})

export default router
